/**
 * AddressBook.java
 * 通讯录
 * 
 * lssrc.com
 * 2012-12-15
 */
package com.lssrc.pams.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "pams_addressbook")
public class AddressBook extends BasePOJO {

	private static final long serialVersionUID = 1L;
	private PamsUser user;
	private PamsUser friend;
	private String time;
	private Integer state;

	public AddressBook() {
		super();
	}

	public AddressBook(PamsUser user, PamsUser friend) {
		super();
		this.user = user;
		this.friend = friend;
	}

	public AddressBook(PamsUser user, PamsUser friend, String time, Integer state) {
		super();
		this.user = user;
		this.friend = friend;
		this.time = time;
		this.state = state;
	}

	@Id
	@ManyToOne
	@JoinColumn(name = "user", referencedColumnName = "username")
	public PamsUser getUser() {
		return user;
	}

	public void setUser(PamsUser user) {
		this.user = user;
	}

	@Id
	@ManyToOne
	@JoinColumn(name = "friend", referencedColumnName = "username")
	public PamsUser getFriend() {
		return friend;
	}

	public void setFriend(PamsUser friend) {
		this.friend = friend;
	}

	@Column(length = 20)
	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	@Column(length = 1, nullable = false)
	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@Override
	public boolean equals(Object obj) {
		return super.equals(obj);
	}

	@Override
	public int hashCode() {
		return super.hashCode();
	}

}